﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace NullBrowser
{
    public partial class Form1 : NullBroswerForm
    {
        private string m_stPath = "";
        private string m_stPostFix = "/index.swf";
        private Uri m_obUrl = null;
        private bool m_isFlash = false;
        
        //∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥构造函数
        public Form1()
        {
            InitializeComponent();
            //m_obPath.KeyDown += new KeyEventHandler(webPath_KeyDown);
            this.KeyDown += new KeyEventHandler(Form1_KeyDown);
            //this.backMovie = Environment.CurrentDirectory +  "\\NullBrowser.swf";
            this.backMovie = "D:\\_sharedFolder\\NullBrowser.swf";
        }
       
        //∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥按键处理函数
        void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F5)
            {
                try
                {
                    if (m_isFlash)
                    {
                        //m_obPlayer.Refresh();
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }

        //∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥按键处理函数
        void webPath_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                try
                {
                    //m_obUrl = new Uri(m_obPath.Text);
                }
                catch
                {
                    //m_obPath.Text = "http://" + m_obPath.Text;
                    //m_obUrl = new Uri(m_obPath.Text);
                }
                //m_stPath = m_obPath.Text;
                if (UrlRequest.Exists(m_stPath + m_stPostFix))
                {
                    //MessageBox.Show("flash");
                    m_stPath += m_stPostFix ;
                    m_isFlash = true;
                    //m_obPage.Parent = null;
                    //m_obPlayer.Parent = this;
                    //m_obPath.Parent = this;
                    //m_obPath.Dock = DockStyle.Top;
                    //m_obPlayer.Dock = DockStyle.Fill;
                    //m_obPlayer.Movie = m_stPath;
                }
                else
                {
                    //MessageBox.Show("page");
                    m_isFlash = false;
                    //m_obPlayer.Parent = null;
                    //m_obPage.Parent = this;
                    //m_obPath.Parent = this;
                    //m_obPath.Dock = DockStyle.Top;
                    //m_obPage.Dock = DockStyle.Fill;
                    //m_obPage.Url = m_obUrl;
                }
            }
        }
        //∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥∥
    }
}